<?php

namespace app\api\controller\balance;

use think\Db;

/**
 * 认购
 * Class
 * @package
 */
class Buying
{

	/**
	 * 实例对象
	 * @var object
	 */
	protected static $instance;

	/**
	 * 默认配置
	 * @var array
	 */
	protected $config  = [
		"log" 		=> "balance_log",
		"draw" 		=> "withdrawal_order"
	];

	/**
	 * 实例化
	 */
	public static function instance()
	{
		if (is_null(self::$instance)) {
			self::$instance = new static();
		}
		return self::$instance;
	}

	/**
	 * 微信支付记录存储
	 */
	public function wechat_pay_notic($option = [])
	{
		try {
			if (is_array($option)) {
				$table = \app\common\func\Tables::instance()->wx_pay_notic_table("wechat_pay_notic", array_keys($option));
				if ($table) {
					\app\common\func\Tables::instance()->check_table_colums($table, array_keys($option));
					Db::name($table)->insert($option);
				}
			}
		} catch (\Exception $e) {
			\think\Log::write($e->getMessage());
		}
	}
}
